/**
 * Copyright (c) 2024 Hunan OpenValley Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef OHOS_TYPES_H
#define OHOS_TYPES_H

#include <cstdint>
#include <map>
#include <multimedia/image_framework/image_pixel_map_mdk.h>
#include <string>

#define TEXTURE_COORDINATES_SIZE 8
#define ATTRIBUTE_SIZE_TWO 2
#define ATTRIBUTE_SIZE_FOUR 4
#define GL_LOG_LENGTH 1024

constexpr int32_t RESULT_LENGTH = 2;
constexpr uint32_t STRING_LENGTH_MAX = 64;

enum class ScaleType {
    CenterInside,
    CenterCrop
};

enum CallbackDataType {
    PIXEL_MAP_COVERT = 1,
};

struct Size {
    uint32_t width{0};
    uint32_t height{0};
};

enum ErrorCode {
    INVALID_IMAGE = 1,
    INVALID_PARAMETER = 2,
    INVALID_CALLBACK
};

const std::map<int32_t, std::string> ERROR_MESSAGES = {
    {INVALID_IMAGE, "Invalid Image."},
    {INVALID_PARAMETER, "Invalid Parameter."},
    {INVALID_CALLBACK, "Invalid Callback."}};

enum class Rotation {
    NORMAL = 0,
    ROTATION_90 = 90,
    ROTATION_180 = 180,
    ROTATION_270 = 270
};

struct PixelMap {
    OhosPixelMapCreateOps ops;
    void *buffer = nullptr;
};

const float NORMAL_CUBE[8] = {
    -1.0f,
    -1.0f,
    1.0f,
    -1.0f,
    -1.0f,
    1.0f,
    1.0f,
    1.0f,
};

const float FLIP_Y_CUBE[8] = {
    -1.0f,
    1.0f,
    1.0f,
    1.0f,
    -1.0f,
    -1.0f,
    1.0f,
    -1.0f,
};

const float FLIP_X_CUBE[8] = {
    1.0f,
    -1.0f,
    -1.0f,
    -1.0f,
    1.0f,
    1.0f,
    -1.0f,
    1.0f,
};

const float FLIP_X_Y_CUBE[8] = {
    1.0f,
    1.0f,
    -1.0f,
    1.0f,
    1.0f,
    -1.0f,
    -1.0f,
    -1.0f,
};

enum Number {
    ZEROTH,
    FIRST,
    SECOND,
    THIRD,
    FOURTH,
    FIFTH,
    SIXTH,
    SEVENTH,
    EIGHTH,
    NINTH,
    TENTH,
    ELEVENTH,
    TWELFTH,
    THIRTEENTH,
    FOURTEENTH,
    FIFTEENTH,
    SIXTEENTH,
    SEVENTEENTH,
    EIGHTEENTH,
    NINETEENTH,
    TWENTIETH
};

enum ColorLevelIndex {
    MIN = 0,
    MID,
    MAX,
    MIN_OUT,
    MAX_OUT,
};

enum RGBA {
    R = 0,
    G,
    B,
    A,
};

enum Vertices {
    LEFT_BOTTOM_X = 0,
    LEFT_BOTTOM_Y,
    RIGHT_BOTTOM_X,
    RIGHT_BOTTOM_Y,
    LEFT_TOP_X,
    LEFT_TOP_Y,
    RIGHT_TOP_X,
    RIGHT_TOP_Y,
};

#endif // OHOS_TYPES_H
